import ReactDOM from 'react-dom'
import React, { Component } from 'react'

// 父组件
class Parent extends Component {
  state = {
    money: 15000
  }
  render() {
    return (
      <div>
        <h1>父组件:{this.state.money}</h1>
        <Child money={this.state.money}></Child>
      </div>
    )
  }
}
// 子组件
class Child extends Component {
  render() {
    return (
      <div>
        <h1>父组件:{this.state.money}</h1>
      </div>
    )
  }
}

// 根组件
class App extends Component {
  render() {
    return (
      <div>
        <Parent />
      </div>
    )
  }
}

ReactDOM.render(<App />, document.getElementById('root'))